package com.example.featuresdk.theme

import androidx.compose.material.Typography
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.ExperimentalUnitApi
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.TextUnitType
import androidx.compose.ui.unit.sp

// Use Material typography styles as defaults
val DefaultTypography = Typography(
    //default text styles to override
    /*
    body1 = TextStyle(
        fontFamily = FontFamily.Default,
        fontWeight = FontWeight.Normal,
        fontSize = 16.sp
    ),
    button = TextStyle(
        fontFamily = FontFamily.Default,
        fontWeight = FontWeight.W500,
        fontSize = 14.sp
    ),
    caption = TextStyle(
        fontFamily = FontFamily.Default,
        fontWeight = FontWeight.Normal,
        fontSize = 12.sp
    )
    */
)

//Define the custom typography styles with meaningful names
@Immutable
data class DemoTypography constructor(
    val header : TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontWeight = FontWeight.Bold,
        fontSize = 20.sp,
        textAlign = TextAlign.Center
    ),
    val featureEntryNormal: TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontWeight = FontWeight.Normal,
        fontSize = 15.sp,
        textAlign = TextAlign.Center
    ),
    val featureEntrySelected: TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontWeight = FontWeight.Bold,
        fontSize = 15.sp,
        textAlign = TextAlign.Center,
        color = Color.Green
    ),
    val title : TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontSize = 18.sp,
        textAlign = TextAlign.Left
    ),
    val titleSuffix : TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontSize = 16.sp,
        textAlign = TextAlign.Right
    ),
    val subtitle : TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontSize = 12.sp,
        textAlign = TextAlign.Left
    ),
    val subtitleSuffix : TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontSize = 12.sp,
        textAlign = TextAlign.End
    ),
    val badge : TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontSize = 10.sp,
        textAlign = TextAlign.Center,
        color = Color.White
    ),
    val button : TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontSize = 14.sp,
        textAlign = TextAlign.Center
    ),
    val messageSent : TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontSize = 18.sp,
        textAlign = TextAlign.Start
    ),
    val messageReceived : TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontSize = 18.sp,
        textAlign = TextAlign.Start
    ),
    val textEmoji: TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontSize = 30.sp
    ),
    val contact: TextStyle = TextStyle(
        fontFamily = FontFamily.Default,
        fontSize = 30.sp
    ),
    //Inherit default material typography by using the same typography name, e.g. body1
    val body1: TextStyle = DefaultTypography.body1
)

//Create a CompositionLocal key that can be provided using CompositionLocalProvider.
val LocalDemoTypography = staticCompositionLocalOf { DemoTypography() }